import Node from './Node'
import { Minder }  from './Minder'
import MinderLayout from './layout/MinderLayout'
import {Stack} from './command/command'
import toolBar from './event/toolbar'
import mindEvent from './event/mindEvent'
import Clock from './clock'

var zr=zrender.init(document.getElementById('mindEditor'),{
  renderer:'canvas'
});

//添加代码
var data={
    id:1,
    text:'根节点',
    textFill:'#fff',
    textPadding:[15,20,15,20],
    fontSize:18,
    textBackgroundColor:'#00aaff',
    textBorderRadius:4,
    textOffset:[10,6],
    children:[
        {
            id:2,
            text:'节点2',
            children:[
               {
                  id:4,
                  text:'节点4'
                },
                {
                   id:6,
                   text:'节点6'
                 }
            ]
        },
        {
            id:3,
            text:'节点3',
            children:[
               {
                  id:5,
                  text:'节点5'

                },
                {
                   id:7,
                   text:'节点7'
                 }
            ]
        },
    ]
};

var minder=new Minder(data);

zr.add(minder);
var stack=new Stack(30);
toolBar.init(zr,stack);
mindEvent.init(zr,stack,minder);

minder.registerLayout('minder',new MinderLayout());

minder.useLayout('minder');

minder.getRoot().setPosition(300,300);    //设置根节点位置
minder.getRoot().setData({
        textFill:'#fff',
        textPadding:[15,20,15,20],
        fontSize:18,
        textBackgroundColor:'#00aaff',
        textBorderRadius:4,
        textOffset:[10,6]
 });

minder.layout(minder.getRoot(),'minder');  //思维导图 向两侧发散

window.m=minder;

